//File: EceptionEvent.java

package model;

import java.util.EventObject;

/**
 * A subject (component) "fires" (creates) an ExceptionEvent object
 * whenever an exception occurs in the subject. A component can register to 
 * receive exception events from the subject by calling the subject's 
 * addExceptionListener() method.  This component is now an ExceptionListener. 
 * ExceptionEvent allows listeners to obtain the exception message 
 * that was generated.
 *
 * All events in Swing should extend EventObject
 * 
 * Written from tutorial at 
 * http://www.ugrad.cs.ubc.ca/~cs304/2006W2/tutorials/JDBC/Swing/jdbc_swing.html
 */

public class ExceptionEvent extends EventObject {
    String ExceptionMessage;

    // source cannot be null
    
    public ExceptionEvent(Object source, String exceptionMessage) {
	super(source);
	ExceptionMessage = exceptionMessage;
    }

    public String getMessage() {
	return ExceptionMessage;
    }

    /*
     * Override the super class's toString() method
     */
    
    public String toString() {
	return ExceptionMessage;
    }
}
